A representative example of a typical print statement in a computer program is shown in FIG. 1. This print statement has a format portion, the information contained within the quotes, and a number of parameters thereafter, the "date" and "population".
The format portion is text to be printed as it appears in the print statement. In the print statement in FIG. 1, this includes "On" and "the population was." It also includes a number of format specifiers such as "%s" and "%d" which correspond to specific parameters. The first format specifier "%s" corresponds to the first parameter "date." This relationship between format specifier and parameter results in the parameter "date" being printed in the location "%s" and may be in the form of a string such as Feb. 22, 1990. The second format specifier "%d," in a similar manner, corresponds to the second parameter "population." And because of this relationship, the parameter "population" is printed in that location "%d" and may be in the form of an integer (such as 5,000,000,000). Therefore, the actual message printed on a display may be, for example: "On Feb. 22, 1990 the population was 5,000,000,000".
Parameters also may be in the form of words, real numbers, etc. Depending upon the actual message to be printed, there may or may not be parameters included, which in turn means that there may or may not be any format specifiers.
Print statements such as the one in FIG. 1 are fine as long as they are associated with the English language. However, problems are encountered when the messages must be printed in languages other than English. A first method for printing such non-English messages would be to replace the messages in the main program with equivalent, translated messages. The problem with this method, however, is that there would have to be a separate main program for each of the languages since the different language structures would require different print statements. Considering that such programs may be as much as a hundred thousand lines in length, this method is not a practical solution.
Another approach, which is somewhat more efficient, involves creating a separate, language-dependent file containing the messages for each language. This will allow the language-independent main program to be used without the need of being altered regardless of the language in which the message will be printed. In this approach, a language-independent print statement is used in the main program instead of one like that illustrated in FIG. 1. The type of print statement that should be used is shown in FIG. 2. A portion of the language-dependent file (English) associated with this type of print statement is shown in FIG. 3.
Each message to be printed by the main program is represented by a variable having a unique name. For example, in the print statement shown in FIG. 2, the variable representing the message shown in FIG. 1 is "pop.sub.- message". Each variable in turn is defined for all of the languages in which the message is to be printed (i.e., in language-dependent files). That is, the variable "pop.sub.- message" is defined in English in a file for the English language, as well as in other applicable languages in a file for each of those languages (not shown). Each of these language-dependent files also contains a definition of all of the other variables representing the various messages in the main program (also not shown). Hence, the main program will remain unchanged, while the definition of the variables will depend on the particular language in which the messages are to be printed.
The format specifiers in a language-dependent file have to appear in the same order as their corresponding parameters in the print statement of the main program. For example, in the print statement in FIG. 2, the date will appear first (as a string) and the population will appear second (as an integer). This will ensure that the parameter values will be printed in the proper form and in the proper location without changing the print statement.
As a result, the first parameter in the print statement (i.e., the date) will always be printed before the second parameter in the print statement (i.e., the population), regardless of the particular language involved. As an example, there is no problem using the print statements in FIGS. 1 and 2 in the English language because these print statements are constructed for this language. However, when it is necessary to translate the message into a different language, the same message may read awkwardly if the date is forced to appear first and the population second. And perhaps, a particular message may not be able to be translated into a specific language since it may be incomprehensible if the parameter values are forced to appear inflexibly in a special order.
By way of example, in the German language, verbs often appear towards the end of a sentence. If, however, a verb was the first parameter of a print statement (e.g., to make the sentence clearer when printed in the English language), a translation of the sentence into the German language may not be possible, but even if possible, may result in a very awkward German sentence.
There is a need to find a system and method that permits movement of parameters to suit a particular language without the need to change the main program.